﻿using PidKeyReptile.Desktop.CrawlTask;
using PidKeyReptile.Desktop.Pages.Checker;
using PidKeyReptile.Desktop.Pages.Crawler;
using Quartz;
using Stylet;
using StyletIoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PidKeyReptile.Desktop.QuartzTask
{
    public class AihaoSyncjob : IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            var obj=context.JobDetail.JobDataMap["Crawler"];
            if (obj is CrawlerManagerViewModel crawler)
            {
                return Task.Run(async () =>
                {
                    crawler.LogText += ($"{DateTime.Now}--开始采集aihao.com\r\n");
                    await new Aihao_CC(crawler).CaptureAsync("https://www.aihao.cc/");
                });
            }
            else
            {
                return null;
            }
            
        }
    }
}
